function [U, EN, ET, EW, ENQ] = MM1(lambda, mu)

%*************************************************************************
%   Author: Eric Humenay, ebh5n@cs.virginia.edu; Xiuduan Fang, xf4c@virginia.edu; 
%   Date: Nov 20, 2006
%   \Brief:     MM1.m calculates utilization, the mean number of customer in the system, mean response time, 
%   mean waiting time, and mean number of customers in an M/M/1 queue.
%   \Input:
%       \lamda: the call arrival rate
%       \mu:   service rate per system
%   \return
%   U: utilization
%   EN: the mean number of customers in the system
%   ET: mean response time per customer
%   EW: mean waiting time in queue
%   ENQ: mean number of customers in queue
%***********************************************************************************
if lambda<=0
    fprintf ('Syntax: MM1(lambda, mu)');
    error ('Bad parameter: lambda shoud be greater than 0 ');
elseif  mu<=lambda
    fprintf ('Syntax: MM1(lambda, mu)');
    error ('Bad parameter: mu should be greater than lambda to have the system stable ');
end

rho = lambda/mu;
U = rho;
EN = rho/(1-rho);
ET = EN/lambda;
EW = rho/(mu-lambda);
ENQ = lambda*EW;
